<template>
  <div class="login">
  	<img src="../assets/bg.png">
  	<div class="title">立信个税精灵后台管理系统</div>
    <div class="logo-message">
      <p>账号：</p>
      <input type="text" id="userName" name="userName"  placeholder="请输入账号" class="input" v-model="userName">
      <input type="hidden" id="pwd" name="user_psw">
      <div id="userNameInfo"></div>
      <p>密码：</p>
      <input type="password" id="userPwd" name="passWord" placeholder="请输入密码" class="input" v-model="userPwd" @keyup.13="login">
      <p class="btn">
        <button class="Public-btn" @click="login">登录</button>
      </p>
    </div>
	</div>
</template>

<script>
import "../lib/http.js";
export default {
  name: "login",
  data() {
    return {
      userName: "",
      userPwd:""
    };
  },
  mounted:function(){

  },
  methods: {
    login:function() {
      this.$post(
	      '/user/authUser',
	      {
	        userName:this.userName,
	        userPwd:this.userPwd
	      }
      ).then(response => {
       	if(response.resultCode=="-1"){
          layer.alert(response.resultMsg);
        }
        if(response.resultCode=="0") {
        	this.set("curIndex",0);
        	this.set("userName",this.userName);
         	this.$router.push({path: '/main/policyRelease'});
        }
     	}).catch(err => {
		  	console.log(err)
			})
    },
  },

};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style  lang="less" scoped>
	.login{
		  position: absolute;
	    width: 400px;
	    height: 400px;
	    left: 50%;
	    top: 50%;
	    margin-top: -200px;
	    margin-left: -200px;
		>img{
			position: fixed;
			width: 100%;
			top: 0;
			left: 0;
			right: 0;
			bottom:0;
			z-index: 12;
		}
		>.logo-message{
			background: #fff;
			width: 400px;
			height: 300px;
			position: absolute;
			top: 70px;
			z-index: 100;
			padding: 20px;
			>p{
				margin: 20px 0;
				font-size: 18px;
			}
			>.input{
				width: 360px
			}
			>p.btn{
				text-align: center;
			}
		}
		>.title{
			font-size: 24px;
			color: #fff;
			position: relative;
			z-index: 100;
			text-align: center;
		}
	}
</style>
